package com.igeek.javase.ch06.jdbc.dao;

import com.igeek.javase.ch06.jdbc.entity.Stus;
import com.igeek.javase.ch06.jdbc.utils.JDBCUtilsByC3P0;

import java.sql.SQLException;
import java.util.List;

/*
 *@author wangpeng
 *2023/7/20 17:33
 *@description TODO
 */
public class StusDao extends BaseDao<Stus>{

    // 1.统计学生名单

    public List<Stus> selectName() throws SQLException {
        String sql = "select  name from stus ";
        List<Stus> stuses = this.selectAll(JDBCUtilsByC3P0.getConn(),sql,Stus.class,null);
        return stuses;
    }
    // 2.查看学生名单

    // 3.按学号查询学生姓名
    public List<Stus>selectByName(String id) throws SQLException {
        String sql = "select name from where id = ?";
        List<Stus> stuses = this.selectAll(JDBCUtilsByC3P0.getConn(),sql,Stus.class,id);
        return stuses;
    }
    // 4.按姓名查询学生信息
    public List<Stus> selectByname(String name) throws SQLException {
        String sql = "select * from stus where name = ?";
        List<Stus> stuses = this.selectAll(JDBCUtilsByC3P0.getConn(),sql,Stus.class,name);
        return stuses;
    }
//    // 5.修改学生出生日期
//    public int changeBirthday(String id){
//        String sql = "update  stus set birthday = ? where id = ?";
//
//                //update girl set phone='18209876579' where id=12;
//    }
    // 6.删除学生记录
    // 0.退出


}
